home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kio / paste.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  4.7 KB  |  126 lines

  1. /* This file is part of the KDE libraries
  2.    Copyright (C) 2000-2005 David Faure <faure@kde.org>
  3.  
  4.    This library is free software; you can redistribute it and/or
  5.    modify it under the terms of the GNU Library General Public
  6.    License version 2 as published by the Free Software Foundation.
  7.  
  8.    This library is distributed in the hope that it will be useful,
  9.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  11.    Library General Public License for more details.
  12.  
  13.    You should have received a copy of the GNU Library General Public License
  14.    along with this library; see the file COPYING.LIB.  If not, write to
  15.    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  16.    Boston, MA 02110-1301, USA.
  17. */
  18.  
  19. #ifndef __kio_paste_h__
  20. #define __kio_paste_h__
  21.  
  22. #include <qstring.h>
  23. #include <qmemarray.h>
  24. #include <kurl.h>
  25. class QWidget;
  26. class QMimeSource;
  27.  
  28. // KDE4 TODO pass a parent widget to all methods that will display a message box
  29.  
  30. namespace KIO {
  31.   class Job;
  32.   class CopyJob;
  33.  
  34.   /**
  35.    * Pastes the content of the clipboard to the given destination URL.
  36.    * URLs are treated separately (performing a file copy)
  37.    * from other data (which is saved into a file after asking the user
  38.    * to choose a filename and the preferred data format)
  39.    *
  40.    * @param destURL the URL to receive the data
  41.    * @param move true to move the data, false to copy
  42.    * @return the job that handles the operation
  43.    * @see pasteData()
  44.    */
  45.   KIO_EXPORT Job *pasteClipboard( const KURL& destURL, bool move = false );
  46.  
  47.   /**
  48.    * Pastes the given @p data to the given destination URL.
  49.    * NOTE: This method is blocking (uses NetAccess for saving the data).
  50.    * Please consider using pasteDataAsync instead.
  51.    *
  52.    * @param destURL the URL of the directory where the data will be pasted.
  53.    * The filename to use in that directory is prompted by this method.
  54.    * @param data the data to copy
  55.    * @see pasteClipboard()
  56.    */
  57.   KIO_EXPORT void pasteData( const KURL& destURL, const QByteArray& data );
  58.  
  59.   /**
  60.    * Pastes the given @p data to the given destination URL.
  61.    * Note that this method requires the caller to have chosen the QByteArray
  62.    * to paste before hand, unlike pasteClipboard and pasteMimeSource.
  63.    *
  64.    * @param destURL the URL of the directory where the data will be pasted.
  65.    * The filename to use in that directory is prompted by this method.
  66.    * @param data the data to copy
  67.    * @see pasteClipboard()
  68.    */
  69.   KIO_EXPORT CopyJob *pasteDataAsync( const KURL& destURL, const QByteArray& data );
  70.  
  71.   /**
  72.    * Pastes the given @p data to the given destination URL.
  73.    * Note that this method requires the caller to have chosen the QByteArray
  74.    * to paste before hand, unlike pasteClipboard and pasteMimeSource.
  75.    *
  76.    * @param destURL the URL of the directory where the data will be pasted.
  77.    * The filename to use in that directory is prompted by this method.
  78.    * @param data the data to copy
  79.    * @param dialogText the text to show in the dialog
  80.    * @see pasteClipboard()
  81.    */
  82.   KIO_EXPORT CopyJob *pasteDataAsync( const KURL& destURL, const QByteArray& data, const QString& dialogText ); // KDE4: merge with above
  83.  
  84.  
  85.   /**
  86.    * Save the given mimesource @p data to the given destination URL
  87.    * after offering the user to choose a data format.
  88.    * This is the method used when handling drops (of anything else than URLs)
  89.    * onto kdesktop and konqueror.
  90.    *
  91.    * @param data the QMimeSource (e.g. a QDropEvent)
  92.    * @param destURL the URL of the directory where the data will be pasted.
  93.    * The filename to use in that directory is prompted by this method.
  94.    * @param dialogText the text to show in the dialog
  95.    * @param widget parent widget to use for dialogs
  96.    * @param clipboard whether the QMimeSource comes from QClipboard. If you
  97.    * use pasteClipboard for that case, you never have to worry about this parameter.
  98.    *
  99.    * @see pasteClipboard()
  100.    *
  101.    * @since 3.5
  102.    */
  103.   KIO_EXPORT CopyJob* pasteMimeSource( QMimeSource* data, const KURL& destURL,
  104.                                        const QString& dialogText, QWidget* widget,
  105.                                        bool clipboard = false );
  106.  
  107.   /**
  108.    * Checks whether the clipboard contains any URLs.
  109.    * @return true if not
  110.    * Not used anymore, wrong method name, so it will disappear in KDE4.
  111.    */
  112.   KIO_EXPORT_DEPRECATED bool isClipboardEmpty();
  113.  
  114.   /**
  115.    * Returns the text to use for the Paste action, when the application supports
  116.    * pasting files, urls, and clipboard data, using pasteClipboard().
  117.    * @return a string suitable for KAction::setText, or an empty string if pasting
  118.    * isn't possible right now.
  119.    *
  120.    * @since 3.5
  121.    */
  122.   KIO_EXPORT QString pasteActionText();
  123. }
  124.  
  125. #endif
  126.